﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _2023_5_14闹钟走马灯等
{
    public partial class Form1 : Form
    {
        public int _hour=0;
        public int _minutes=0;
        public int _second=0;

        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
           //ateTime time = new DateTime();
            timeShow.Text = DateTime.Now.ToString();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timeShow.Text = DateTime.Now.ToString();
            if(_hour==0||_minutes==0||_second==0)
            {}
            else
            {
                if(DateTime.Now.Hour==_hour&&DateTime.Now.Minute==_minutes&&DateTime.Now.Second==_second)
                {
                    SoundPlayer sound = new SoundPlayer();
                    sound.SoundLocation = @"E:\其他\音乐\test\RADWIMPS、十明 - すずめ (铃芽).wav";
                    sound.Play();
                }
            }
            
        }

        private void getAlramLockTime_Tick(object sender, EventArgs e)
        {
            string temp = getTime.Text;
            string[] arr = temp.Split(':');
            if (arr.Length == 3)
            {
                int.TryParse(arr[0], out _hour);
                int.TryParse(arr[1], out _minutes);
                int.TryParse(arr[2], out _second);
            }
            if (_hour == 0 || _minutes == 0 || _second == 0)
            { }
            else
            {
                if (DateTime.Now.Hour == _hour && DateTime.Now.Minute == _minutes && DateTime.Now.Second == _second)
                {
                    SoundPlayer sound = new SoundPlayer();
                    sound.SoundLocation = @"E:\会议\WeMeet\3.16.1.461\resources\raw\ringing.wav";
                    sound.PlaySync();
                }
            }
        }
    }
}
